package API.DateDome.LocalDateTimeDome;

import java.time.Instant;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;

/**
 * ClassName:LocalDateTimeText002
 * Package:API.DateDome.LocalDateTimeDome
 * Description:
 *
 * @Author:ZhangXin
 * @Create2023/2/2-13:36
 * @Version:v1.0
 */
public class LocalDateTimeText002 {
    public static void main(String[] args) {
        //获取时间对象
        ZonedDateTime time = Instant.now().atZone(ZoneId.of("Asia/Shanghai"));
        //解析/格式化器
        DateTimeFormatter dtf1 = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss EE a");
        //格式化
        System.out.println(dtf1.format(time));//2023-02-02 13:41:15 周四 下午
    }

}
